import { axios } from '@/utils/request'

/**
 * api接口列表
 */
const api = {
  list: '/erp_meixingtiyu/timeTemplate/list',
  add: '/erp_meixingtiyu/timeTemplate/add',
  edit: '/erp_meixingtiyu/timeTemplate/edit',
  delete: '/erp_meixingtiyu/timeTemplate/delete',
  fragments: '/erp_meixingtiyu/timeTemplate/fragments',
  addFragment: '/erp_meixingtiyu/timeTemplate/addFragment',
  editFragment: '/erp_meixingtiyu/timeTemplate/editFragment',
  delFragment: '/erp_meixingtiyu/timeTemplate/delFragment',
}

/**
 * 模板列表
 */
export function list (params) {
  return axios({
    url: api.list,
    method: 'get',
    params
  })
}

/**
 * 添加模板
 */
 export function add (params) {
  return axios({
    url: api.add,
    method: 'get',
    params
  })
}

/**
 * 编辑模板
 */
 export function edit (params) {
  return axios({
    url: api.edit,
    method: 'get',
    params
  })
}

/**
 * 编辑模板
 */
 export function del (params) {
  return axios({
    url: api.delete,
    method: 'get',
    params
  })
}

/**
 * 获取指定模板id下的所有时段
 */
 export function fragments (params) {
  return axios({
    url: api.fragments,
    method: 'get',
    params
  })
}

/**
 * 给指定模板添加时段
 */
 export function addFragment (params) {
  return axios({
    url: api.addFragment,
    method: 'get',
    params
  })
}

/**
 * 编辑指定时段
 */
 export function editFragment (params) {
  return axios({
    url: api.editFragment,
    method: 'get',
    params
  })
}

/**
 * 删除指定时段
 */
 export function delFragment (params) {
  return axios({
    url: api.delFragment,
    method: 'get',
    params
  })
}